﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QuantitativeInvestment.Bean;
using QuantitativeInvestment.Tools;

namespace QuantitativeInvestment.Factor
{
    class AroonOscFactor:Factor
    {
        public AroonOscFactor()
        {
            this.name = "阿隆震荡指标";
            Parameter p = new Parameter("天数",30);
            this.paraList.Add(p.name,p);
        }
        public override void addFactorValue(Stock stock)
        {
            int num = Int32.Parse(this.paraList["天数"].value.ToString());

            if (!stock.factors.ContainsKey(this.name + this.paraList["天数"].value.ToString()))
            {
                TaLib lib = new TaLib();

                double[] aroonOscValues = lib.getAroonOsc(stock.factors["最高价"], stock.factors["最底价"], num);
                int length=stock.factors["最高价"].Length;

                stock.factors.Add(this.name + this.paraList["天数"].value.ToString() + "阿隆震荡", aroonOscValues);
                }
        }
    }
}
